ActionController::Routing::Routes.draw do |map|
  
  map.toggle_resolved_lost_items 'lost_items/toggle_resolved', :controller => 'lost_items', :action => 'toggle_resolved'
  map.resources :lost_items

  map.resources :stops

  map.checklist_recurrence_rules 'checklists/:id/edit', :controller => 'checklists',
    :action => 'create_rule', :conditions => { :method => :post }
  map.destroy_checklist_recurrence_rule 'checklists/:id/edit', :controller => 'checklists',
    :action => 'destroy_rule', :conditions => { :method => :delete }

  map.resources :route_instances

  map.resources :stop_instances

  map.toggle_hidden_routes 'routes/toggle_hidden', :controller => 'routes', :action => 'toggle_hidden'
  map.resources :routes
  
  map.route_recurrence_rules 'routes/:id/edit', :controller => 'routes', 
	:action => 'create_rule', :conditions => { :method => :post }
  map.destroy_route_recurrence_rule 'routes/:id/edit', :controller => 'routes',
	:action => 'destroy_rule', :conditions => { :method => :delete }
  
  map.resources :checklist_instances

  map.resources :checklist_item_instances

  map.resources :checklist_items

  map.toggle_hidden_checklists 'checklists/toggle_hidden', :controller => 'checklists', :action => 'toggle_hidden'
  map.resources :checklists

  map.resources :couriers
  
  map.toggle_hidden_locations 'locations/toggle_hidden', :controller => 'locations', :action => 'toggle_hidden'
  map.resources :locations

  map.resources :check_ins

  map.resources :users

  map.resources :comments

  map.resources :item_types

  map.resources :item_attribute_sets

  map.resources :item_attributes

  map.resources :identifiers

  map.connect 'items/lookup', :controller => 'items', :action => 'lookup'
  map.connect 'items/incoming', :controller => 'items', :action => 'incoming'
  map.connect 'items/outgoing', :controller => 'items', :action => 'outgoing'
  map.connect 'items/:id/add_to_container', :controller => 'items', :action => 'add_to_container'
  map.resources :items
  
  map.login 'home/login.:format', :controller => 'home', :action => 'login'
  map.logout 'home/logout', :controller => 'home', :action => 'logout'
  
  map.connect 'errors/permissions', :controller => 'errors', :action => 'permissions'


  map.connect 'help', :controller => 'help', :action => 'help_index'
  map.connect 'help/items', :controller => 'help', :action => 'help_items'
  map.connect 'help/couriers', :controller => 'help', :action => 'help_couriers'
  map.connect 'help/users', :controller => 'help', :action => 'help_users'
  map.connect 'help/locations', :controller => 'help', :action => 'help_locations'
  map.connect 'help/routes', :controller => 'help', :action => 'help_routes'
  map.connect 'help/checklists', :controller => 'help', :action => 'help_checklists'
  map.connect 'help/android', :controller => 'help', :action => 'help_android'

  # The priority is based upon order of creation: first created -> highest priority.

  # Sample of regular route:
  #   map.connect 'products/:id', :controller => 'catalog', :action => 'view'
  # Keep in mind you can assign values other than :controller and :action

  # Sample of named route:
  #   map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   map.resources :products

  # Sample resource route with options:
  #   map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }

  # Sample resource route with sub-resources:
  #   map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
  
  # Sample resource route with more complex sub-resources
  #   map.resources :products do |products|
  #     products.resources :comments
  #     products.resources :sales, :collection => { :recent => :get }
  #   end

  # Sample resource route within a namespace:
  #   map.namespace :admin do |admin|
  #     # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
  #     admin.resources :products
  #   end

  # Install the default routes as the lowest priority.
  # Note: These default routes make all actions in every controller accessible via GET requests. You should
  # consider removing or commenting them out if you're using named routes and resources.

  # Homepage
  map.root :controller => :home, :action => :login

  # See how all your routes lay out with "rake routes"

  # Defaults
  map.connect ':controller/:action'
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'

end
